import Vue from "vue";
import App from "@/App";
import { theme } from "@/utils/common"; // 引入微服务通用包
import store from "@/store";
import router from "@/router";
import VueMeta from "vue-meta"; // 头部标签组件
import Avue from "@haiking/avue"; // avue
import "@haiking/micro-common/lib/micro.css";
import "@/assets/styles/index.scss"; // TODO 待抽 全局样式
import "@haiking/avue/lib/index.css"; // avue css
import "element-ui/lib/theme-chalk/index.css";
import filters from "@/filters"; // 全局过滤器
import directive from "@/directive"; // 全局指令
import componentInstall from "./commonComponents"; // TODO 待抽 全局组件
import setting from "@/settings"; // 全局配置
import tabs from "@/utils/tab"; // tab方法
import "@/router/permission"; // 权限处理
import { qiankunActions } from "./qiankun/index"; // 微服务主 子通信方法
// import "@/utils/fiexible"; // 引入flexible兼容分辨率

// 国旗样式
import "flag-icons/css/flag-icons.min.css";

// 开启mock 模拟请求数据
if (process.env.NODE_ENV === "development" || process.env.NODE_ENV === "production") {
  const { mockXHR } = require("../mock");
  mockXHR();
}

// 无线滚动插件
import VueScroll from "@david-j/vue-j-scroll";
import VScaleScreen from "v-scale-screen";
Vue.use(VueScroll);
Vue.use(VScaleScreen);

Vue.use(directive);
Vue.use(filters);
Vue.use(VueMeta);
Vue.use(Avue, {
  size: "normal",
  axios: Vue.prototype.axios,
});
Vue.use(componentInstall);
Vue.prototype.$apiroot =
  process.env.NODE_ENV === "development"
    ? "/api"
    : `${process.env.VUE_APP_BASE_API}`;
Vue.config.productionTip = false;
Vue.prototype.$actions = qiankunActions;
setting.sideThemeList = theme;
Vue.prototype.$setting = setting;
Vue.prototype.$tab = tabs;
new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#main");
